package demo.jdk.features.jdk7;

import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * @author Ranchoz  2018/9/9 15:34
 **/
public class ListFile {
	public void listFiles() throws IOException {
		Path path = Paths.get("");
		try (DirectoryStream<Path> stream = Files.newDirectoryStream(path, "*.*")) {
			for (Path entry: stream) {
				//使用entry
				System.out.println(entry);
			}
		}
	}
	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) throws IOException {
		ListFile listFile = new ListFile();
		listFile.listFiles();
	}
}
